/**
 * 代号:金花 
 * 文件名：Client.java
 * 创建人：jh
 * 日期：2018年7月3日
 * 修改人：
 * 描述：
 */
package cc.pattern.factory;

import cc.pattern.util.Console;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 优点
1）优秀的扩展性。假如披萨不想吃了，想吃芝士蛋糕，只需要增加芝士蛋糕的具体工厂和具体产品类，不会影响其他产品的生产。

2）大降低代码的耦合度，客户端最终得到的是产品本身，而不需要知道和操作产品的生产过程。

缺点
1）增加新产品时，需要增加具体的工厂类和具体的产品类，当产品数量多的时候就会造成系统的复杂度增大，也增加了对系统理解的难度。
 */
public class Client {
public static void main(String[] args) {
	 // 生产雪糕
    Factory iceCreamFactory = new IceCreamFactory();
    Product iceCream = iceCreamFactory.factory();
    iceCream.product();
    
    // 生产披萨
    Factory pizzaFactory = new PizzaFactory();
    Product pizza = pizzaFactory.factory();
    pizza.product();
    
    
    Factory cakeFactory = new CakeFactory();
    Product cake = cakeFactory.factory();
    cake.product();
    
    Factory waterFactory = new WaterFactory();
    Product water = waterFactory.factory();
    water.product();

    Factory singFactory = new SingFactory();
    Product factory = singFactory.factory();
    factory.product();

    //一杯咖啡
    Factory coffeeFactory = new CoffeeFactory();
    Product coffee = coffeeFactory.factory();
    coffee.product();
    
    Factory phoneFactory = new PhoneFactory();
    Product phone = phoneFactory.factory();
    phone.product();
    
    
    Factory appleFactory = new AppleFactory();
    Product apple = appleFactory.factory();
    apple.product();
    
    List<String> asList = Arrays.asList("1","2");
	asList.forEach(str  ->{
		Console.log(str);
	});
	
	List<String> list = new ArrayList<>();
	Console.log(list.get(0));
}
}
